home *** CD-ROM | disk | FTP | other *** search
- Program AntiPre;
- {$M 4096,0,0}
- Uses Crt;
- Var Fil:File;
- I,N,M,R,G,B,NearDist,Dist,ColorSeg:Word;
- Rd,Gd,Bd:Integer;
- Err,Col:Byte;
- Palette:Array[0..767] Of Byte;
- Begin
- Asm Mov Err,00h
- Mov Ah,48h
- Mov Bx,1000h
- Int 21h
- Adc Err,00h
- Mov ColorSeg,Ax
- End;
- If Err>0 Then Begin WriteLn('Not enough memory!'); Halt(1); End;
- {$I-}
- Assign(Fil,ParamStr(1)); Reset(Fil,1);
- If IOResult<>0 Then Begin WriteLn('File not found!'); Halt(1); End;
- {Seek(Fil,32);} BlockRead(Fil,Palette,768); Close(Fil);
- Asm Mov Ax,0003h; Int 10h; End;
- { For N:=0 to 767 Do Palette[N]:=Palette[N] Shr 2;}
- For N:=0 to 255 Do For M:=0 to 255 Do Begin
- R:=Round((Palette[N*3+0]*2.5+Palette[M*3+0]*1)/3.5);
- G:=Round((Palette[N*3+1]*2.5+Palette[M*3+1]*1)/3.5);
- B:=Round((Palette[N*3+2]*2.5+Palette[M*3+2]*1)/3.5);
- NearDist:=65535;
- For I:=0 to 255 Do Begin
- Rd:=Palette[I*3+0]-R;
- Gd:=Palette[I*3+1]-G;
- Bd:=Palette[I*3+2]-B;
- Dist:=Rd*Rd+Gd*Gd+Bd*Bd;
- If Dist<NearDist Then Begin NearDist:=Dist; Col:=I; End;
- End;
- Mem[ColorSeg:N+M Shl 8]:=Col;
- GotoXY(1,1); Write(100*N/255:5:1,'%');
- End;
- Assign(Fil,'AALIAS.DAT'); ReWrite(Fil,1);
- { BlockWrite(Fil,Palette,768);}
- BlockWrite(Fil,Mem[ColorSeg:0],32768);
- BlockWrite(Fil,Mem[ColorSeg:32768],32768); Close(Fil);
-
- Asm Mov Ax,0013h; Int 10h; End;
- Port[$3C8]:=0; For N:=0 to 767 Do Port[$3C9]:=Palette[N];
- For N:=0 to 255 Do For M:=0 to 199 Do Mem[$A000:N+M*320]:=N;
- Repeat Until KeyPressed;
- Asm Mov Ax,0003h; Int 10h; End;
- End.
-